/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package msncommonsc;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 *
 * @author Martin
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "Contacto.buscarPorNombre",
    query = "SELECT c FROM Contacto c WHERE c.nombre = :nombre")})
@Inheritance(strategy = InheritanceType.JOINED)
public class Contacto implements Serializable {

    private long id;
    private String nombre;
    private String nick;
    private String estado = EnumEstado.CONECTADO.toString();

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    @Column(unique = true)
    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @Override
    public String toString() {
        return (" -- " + this.getNombre() + " -- \n" + " -- " + this.getNick() + " -- " + this.getEstado() + " -- ");
    }
}
